home *** CD-ROM | disk | FTP | other *** search
- Path: anvil.ugrad.cs.ubc.ca!not-for-mail
- From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
- Newsgroups: comp.lang.c
- Subject: Re: gettimeofday() makes me mad !
- Date: 28 Feb 1996 11:38:23 -0800
- Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
- Message-ID: <4h2avfINNd6a@anvil.ugrad.cs.ubc.ca>
- References: <4gnkth$4on@piston.ecp.fr> <4gu1ue$39m@news-f.iadfw.net> <fcusack-2802961119240001@mudskipper.cac.psu.edu>
- NNTP-Posting-Host: anvil.ugrad.cs.ubc.ca
-
- In article <fcusack-2802961119240001@mudskipper.cac.psu.edu>,
- frank. <fcusack@tdx.org> wrote:
- >In article <4gu1ue$39m@news-f.iadfw.net>, alpet@airmail.net (Adam
- >Peterson) wrote:
- >
- >>
- >> >PROBLEM : I'm trying to make a little program which must repeat an
- >> >action every .2 second for example ( less than 1 sec anyway). time()
- >> >wouldn't fit, so I searched and found the function gettimeofday() in
- >>
- >> You are on a Unix system, any reason you are not using 'sleep'?
- >>
- >
- >sleep only works in whole seconds.
-
- The age-old answer is to use the select() call, with zero for the number of
- file descriptors to poll, a null pointer for all three file descriptor sets,
- and a pointer to a timeval structure containing your desired sleep delay.
- I think that a lot of new UNIX programmers still discover this independently.
-
- In any case, this is for comp.unix.programmer. If the original poster had gone
- there and read the FAQ's, I'm sure his question would have been answered.
- --
-
-